import request from '@/utils/request.js'
import postWithDelay from '@/utils/request_delay.js'
import {mappingAdress } from '@/utils/util.js'

export const getPhone = data => request.get(mappingAdress.get('/weChat/login/phone'), data) 

export const login = data => request.post(mappingAdress.get('/weChat/login/auto'), data) 

// 通过jscode换登录信息
export const queryByOpenId = data => request.get(`${mappingAdress.get('/weChat/queryByOpenId')}?jsCode=${data}`, data) 

// 首页免登录获取最新的一条消息
export const queryNewestMessage = data => request.post(mappingAdress.get('/weChat/message/queryNewestMessage'), data) 
// export const queryNewestMessage = data => request.post('/weChat/message/queryNewestMessage', data) 

export const logout = data => request.post(mappingAdress.get('/weChat/logout'), data) 

// 滚动热门搜索
export const hotSearch = data => request.get(mappingAdress.get('/weChat/hotSearch/queryLimit6'), data) 

// 搜索
export const querySearch = data => request.post(mappingAdress.get('/weChat/search/queryBySearchName'), data) 

// 输入搜索
// export const queryTitles = data => request.post('/weChat/search/queryTitles', data) 
export const queryTitles = (data, fn) => postWithDelay(mappingAdress.get('/weChat/search/queryTitles'), data, 300, fn)


// 特色产品榜
export const queryKeyProduction = data => request.get(mappingAdress.get('/weChat/production/queryKeyProduction'), data) 


// 查询首页轮播
export const queryAllPic = data => request.get(mappingAdress.get('/weChat/pollingPicture/queryAll'), data) 

// 特色方案榜
export const queryHomeDisplaySolution = data => request.post(mappingAdress.get('/weChat/solution/queryHomeDisplaySolution'), data) 

// 特色场景榜（新
export const queryHomeDisplaySolutionTypeName = data => request.get(mappingAdress.get('/weChat/solution/queryHomeDisplaySolutionTypeName'), data) 


// 新增业务登记
export const insertRegistration = data => request.post(mappingAdress.get('/weChat/registration/insertRegistration'), data) 

// 新增意见反馈信息
export const insertFeedback = data => request.post(mappingAdress.get('/weChat/feedback/insertFeedback'), data) 


// 获取二维码图片
export const getAppletQRCode = data => request.post(mappingAdress.get('/weChat/getAppletQRCode'), data) 


// 通过图片分享
export const  shareByPicture = data => request.post(mappingAdress.get('/weChat/share/shareByPicture'), data) 


// 给当前用户新增一条消息
export const  addMessageToCurrentMessage = data => request.post(mappingAdress.get('/weChat/message/addMessageToCurrentMessage'), data) 


// 上传图片拼接
export const  compositePicture = data => request.post(mappingAdress.get('/picture/compositePicture'), data) 

// 获取验证码
export const  sendVerifyCode = data => request.get(mappingAdress.get('/verificationCode/login/sendVerifyCode'), data)

// 退出登录
export const  deleteAccount = data => request.post(mappingAdress.get('/weChat/deleteAccount'), data)

// 首页资讯
export const  queryInformation3 = data => request.get(mappingAdress.get('/weChat/information/queryInfo3'), data)
// 资讯分页
export const  queryInformationByPage = data => request.post(mappingAdress.get('/weChat/information/queryInfoByPage'), data)
export const  queryInformationDetail = data => request.get(mappingAdress.get('/weChat/information/queryDetailById'), data)
// 获取一检测额公钥
export const  queryPublicKey = data => request.get(mappingAdress.get('/weChat/querySendInfo'))
